<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>静态数组</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
    </style>
</head>
<body>
    <ul>
        <li>li_1</li>
        <li>li_2</li>
        <li>li_3</li>
        <li>li_4</li>
        <li>li_5</li>
        <li>li_6</li>
    </ul>

    <script src="../lib/jquery/jquery.min.js"></script>
    <script type="text/javascript">
        // jq获取的是静态节点数组，节点更换删除不会影响已获取的数组的
        // document.querySelectorAll() 静态数组
        // getElementsByClass/TagName()   ele.children  动态的节点数组
        var $lis = $("li");
        var lis = document.querySelectorAll("li");

        var liClass = document.getElementsByTagName("li");
        var childs = $("ul")[0].children;

        $lis.eq(3).remove();
        $lis.eq(4).remove();

        $("ul").prepend("<li>li_0</li>");

        console.log("jq", $lis.length); // 6
        console.log("qsa", lis.length);  // 6
        console.log("getTag", liClass.length);  // 5
        console.log("childs", childs.length);  // 5

        console.log($lis[0]);
    </script>
</body>
</html>